Skip to content

Added solution to Project Euler problem 301 #3343

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Nov 1, 2020
Merged

Added solution to Project Euler problem 301 #3343

merged 12 commits into from
Nov 1, 2020

Conversation

KumarUniverse
Copy link
Contributor

@KumarUniverse KumarUniverse commented Oct 15, 2020

Describe your change:

  • Add an algorithm?
  • Fix a bug or typo in an existing algorithm?
  • Documentation change?

Checklist:

  • I have read CONTRIBUTING.md.
  • This pull request is all my own work -- I have not plagiarized.
  • I know that pull requests will not be merged if they fail the automated tests.
  • This PR only changes one algorithm file. To ease review, please open separate PRs for separate algorithms.
  • All new Python files are placed inside an existing directory.
  • All filenames are in all lowercase characters with no spaces or dashes.
  • All functions and variable names follow Python naming conventions.
  • All function parameters and return values are annotated with Python type hints.
  • All functions have doctests that pass the automated testing.
  • All new algorithms have a URL in its comments that points to Wikipedia or other similar explanation.
  • If this pull request resolves one or more open issues then the commit message contains Fixes: #{$ISSUE_NO}.

@TravisBuddy
Copy link

Travis tests have failed

Hey @KumarUniverse,
Please read the following log in order to understand the failure reason.
It'll be awesome if you fix what's wrong and commit the changes.

TravisBuddy Request Identifier: a4930340-0f15-11eb-9bff-abeacd856cb9

@TravisBuddy
Copy link

Travis tests have failed

Hey @KumarUniverse,
Please read the following log in order to understand the failure reason.
It'll be awesome if you fix what's wrong and commit the changes.

TravisBuddy Request Identifier: 049676d0-0f1d-11eb-9bff-abeacd856cb9

@TravisBuddy
Copy link

Travis tests have failed

Hey @KumarUniverse,
Please read the following log in order to understand the failure reason.
It'll be awesome if you fix what's wrong and commit the changes.

TravisBuddy Request Identifier: a271fe60-0f1d-11eb-9bff-abeacd856cb9

Copy link
Member

@l3str4nge l3str4nge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missclick

@TravisBuddy
Copy link

Travis tests have failed

Hey @KumarUniverse,
Please read the following log in order to understand the failure reason.
It'll be awesome if you fix what's wrong and commit the changes.

TravisBuddy Request Identifier: 1bb3c3d0-0f23-11eb-9bff-abeacd856cb9

@KumarUniverse
Copy link
Contributor Author

KumarUniverse commented Oct 15, 2020

Why does the pre-commit run keep failing? The log says isort failed but I don't know what that means.

Copy link
Contributor Author

@KumarUniverse KumarUniverse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, I renamed my lossCount variable to loss_count. Can you review it please?

Akash Kumar added 2 commits October 15, 2020 19:13
@KumarUniverse
Copy link
Contributor Author

I managed to pass all 3 checks and made the requested changes. Can you please accept my pull request? Thank you.

@dhruvmanila dhruvmanila added the awaiting changes A maintainer has requested changes to this PR label Oct 16, 2020
@KumarUniverse
Copy link
Contributor Author

I made the final commits to my pull request. Please accept my pull request. Thank you!

@dhruvmanila
Copy link
Member

dhruvmanila commented Oct 16, 2020

Your solution is taking 3 minutes to run. You need to optimize it to bring it down to seconds. Try not to use brute force in here as time complexity do matter.

https://travis-ci.com/github/TheAlgorithms/Python/jobs/400702745#L243

============================= slowest 10 durations =============================
167.57s call     project_euler/validate_solutions.py::test_project_euler[problem_301/sol1.py]
25.52s call     project_euler/validate_solutions.py::test_project_euler[problem_014/sol1.py]
20.23s call     project_euler/validate_solutions.py::test_project_euler[problem_014/sol2.py]
15.14s call     project_euler/validate_solutions.py::test_project_euler[problem_009/sol1.py]
11.44s call     project_euler/validate_solutions.py::test_project_euler[problem_010/sol1.py]
7.69s call     project_euler/validate_solutions.py::test_project_euler[problem_010/sol2.py]
5.45s call     project_euler/validate_solutions.py::test_project_euler[problem_034/sol1.py]
3.68s call     project_euler/validate_solutions.py::test_project_euler[problem_112/sol1.py]
3.67s call     project_euler/validate_solutions.py::test_project_euler[problem_012/sol1.py]
3.66s call     project_euler/validate_solutions.py::test_project_euler[problem_012/sol2.py]

@dhruvmanila dhruvmanila added on hold require optimization Algorithm needs to be optimized to reduce time complexity labels Oct 16, 2020
@KumarUniverse
Copy link
Contributor Author

KumarUniverse commented Oct 16, 2020

I have optimized my solution and committed the changes @dhruvmanila.

@dhruvmanila dhruvmanila removed require optimization Algorithm needs to be optimized to reduce time complexity on hold labels Oct 25, 2020
@KumarUniverse
Copy link
Contributor Author

I have made the requested changes to the code @dhruvmanila.

Copy link
Member

@dhruvmanila dhruvmanila left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution!

@dhruvmanila dhruvmanila removed the request for review from l3str4nge November 1, 2020 10:55
@dhruvmanila dhruvmanila dismissed l3str4nge’s stale review November 1, 2020 10:57

Changes have been implemented.

@dhruvmanila dhruvmanila merged commit d3ead53 into TheAlgorithms:master Nov 1, 2020
@dhruvmanila dhruvmanila removed the awaiting changes A maintainer has requested changes to this PR label Nov 1, 2020
stokhos pushed a commit to stokhos/Python that referenced this pull request Jan 3, 2021
* Added solution to Project Euler problem 301

* Added newline to end of file

* Fixed formatting and tests

* Changed lossCount to loss_count

* Fixed default parameter value for solution

* Removed helper function and modified print stmt

* Fixed code formatting

* Optimized solution from O(n^2) to O(1) constant time

* Update sol1.py
peRFectBeliever pushed a commit to peRFectBeliever/Python that referenced this pull request Apr 1, 2021
* Added solution to Project Euler problem 301

* Added newline to end of file

* Fixed formatting and tests

* Changed lossCount to loss_count

* Fixed default parameter value for solution

* Removed helper function and modified print stmt

* Fixed code formatting

* Optimized solution from O(n^2) to O(1) constant time

* Update sol1.py
Panquesito7 pushed a commit to Panquesito7/Python that referenced this pull request May 13, 2021
* Added solution to Project Euler problem 301

* Added newline to end of file

* Fixed formatting and tests

* Changed lossCount to loss_count

* Fixed default parameter value for solution

* Removed helper function and modified print stmt

* Fixed code formatting

* Optimized solution from O(n^2) to O(1) constant time

* Update sol1.py
shermanhui pushed a commit to shermanhui/Python that referenced this pull request Oct 22, 2021
* Added solution to Project Euler problem 301

* Added newline to end of file

* Fixed formatting and tests

* Changed lossCount to loss_count

* Fixed default parameter value for solution

* Removed helper function and modified print stmt

* Fixed code formatting

* Optimized solution from O(n^2) to O(1) constant time

* Update sol1.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants